<include file="App/Home/View/Public/header.html"/>
			<!-- BEGIN PAGE CONTENT-->
			<div class="row">
                <div class="col-md-8">
                  <div class="row">
				    <div class="col-md-6 ">
					<!-- BEGIN SAMPLE FORM PORTLET-->
					<div class="portlet box purple ">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-gift"></i> 买入HPP
							</div>
							<div class="tools">
								<a href="" class="collapse">
								</a>
								<a href="#portlet-config" data-toggle="modal" class="config">
								</a>
								<a href="" class="reload">
								</a>
								<a href="" class="remove">
								</a>
							</div>
						</div>
						<div class="portlet-body form">
							<form class="form-horizontal" role="form">
								<div class="form-body">
                                    <div class="form-group">
										<label class="col-md-4 control-label">买入价格：</label>
										<div class="col-md-8">
											<input style="width:98% !important;" type="text" name="buy_money" id="buy_money" class="form-control input-inline input-medium" placeholder="1.0000">
											<!--<span class="help-inline">
											Inline help. </span>-->
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-4 control-label">HPP现价：</label>
										<div class="col-md-8">
											<span class="help-inline" style=" padding-top:9px; color:red;">
											{$nowprice['name']|default="0.00"}</span>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-4 control-label">最大可买：</label>
										<div class="col-md-8">
											<span class="help-inline" style=" padding-top:9px; color:red;">
											{$currency[5]['num']|default="0.00"}</span>
										</div>
									</div>
                                    <div class="form-group">
										<label class="col-md-4 control-label">交易密码：</label>
										<div class="col-md-8">
											<input style="width:98% !important;" name="buy_password" id="buy_password" type="password" class="form-control input-inline input-medium" placeholder="password">
										</div>
									</div>
								</div>
								<div class="form-actions">
									<div class="row">
										<div class="col-md-offset-5 col-md-9">
											<button type="submit" class="btn purple" onclick="sub_buy()">提交</button>
										</div>
									</div>
								</div>
							</form>
						</div>
					</div>
					<script>
					function sub_buy(){
					//获取购买总价格
						var buy_money=$('#buy_money').val();
						var password=$('#buy_password').val();
						if(isNaN(buy_money)){
								alert("价格请输入数字");
								return;
						}
						if(password == ""){
							alert("请输入密码");
							return;
						}
						var url = "{:U('Transaction/buy_transaction')}";
						$.post(url,{'buy_money':buy_money,'password':password},function(data){
								alert(data['info']);
								if(data.status == 1){
								 window.location.reload();
								}
						});
						
					}
					</script>
					<!-- END SAMPLE FORM PORTLET-->
				</div>
                    <div class="col-md-6 ">
					<!-- BEGIN SAMPLE FORM PORTLET-->
					<div class="portlet box green ">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-gift"></i> 卖出HPP
							</div>
							<div class="tools">
								<a href="" class="collapse">
								</a>
								<a href="#portlet-config" data-toggle="modal" class="config">
								</a>
								<a href="" class="reload">
								</a>
								<a href="" class="remove">
								</a>
							</div>
						</div>
						<div class="portlet-body form">
							<form class="form-horizontal" role="form">
								<div class="form-body">
                                    <div class="form-group">
										<label class="col-md-4 control-label">卖出数量：</label>
										<div class="col-md-8">
											<input style="width:98% !important;" type="text" id="sell_num" class="form-control input-inline input-medium">
											<!--<span class="help-inline">
											Inline help. </span>-->
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-4 control-label">HPP现价：</label>
										<div class="col-md-8">
											<span class="help-inline" style=" padding-top:9px; color:red;">
											{$nowprice['name']|default="0.00"}</span>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-4 control-label">最大可卖：</label>
										<div class="col-md-8">
											<span class="help-inline" style=" padding-top:9px; color:red;">
											{$currency[3]['num']|default="0.00"}</span>
										</div>
									</div>
                                    <div class="form-group">
										<label class="col-md-4 control-label">交易密码：</label>
										<div class="col-md-8">
											<input style="width:98% !important;" type="password" id="sell_password" class="form-control input-inline input-medium" placeholder="password">
										</div>
									</div>
								</div>
								<div class="form-actions">
									<div class="row">
										<div class="col-md-offset-5 col-md-9">
											<button type="button" class="btn green" onclick="sub_sell()">提交</button>
										</div>
									</div>
								</div>
							</form>
						</div>
					</div>
					<script>
					function sub_sell(){
						var sell_num=$('#sell_num').val();
						var password=$('#sell_password').val();
						if(isNaN(sell_num)){
								alert("价格请输入数字");
								return;
						}
						if(password == ""){
							alert("请输入密码");
							return;
						}
						$.post("/Home/Transaction/sell_transaction",{'num':sell_num,'password':password},function(data){
								alert(data['info']);
								if(data.status == 1){
								  window.location.reload();
								}
						});
						
					
					}
					</script>
					<!-- END SAMPLE FORM PORTLET-->
				</div>
                  </div>
            <div class="row">
                <div class="col-md-12">
					<!-- BEGIN CONDENSED TABLE PORTLET-->
					<div class="portlet box blue">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-picture"></i>最新交易
							</div>
							<div class="tools">
								<a href="javascript:;" class="collapse">
								</a>
								<a href="#portlet-config" data-toggle="modal" class="config">
								</a>
								<a href="javascript:;" class="reload">
								</a>
								<a href="javascript:;" class="remove">
								</a>
							</div>
						</div>
						<div class="portlet-body">
							<div class="table-scrollable">
								<table class="table table-condensed table-hover">
								<thead>
								<tr>
									<th>成交时间</th>
									<th>类型</th>
									<th>成交价格</th>
									<th>成交量</th>
									<th>总计</th>
								</tr>
								</thead>
								<tbody>
									<volist name="trade" id="vo" >
									  <tr>
										<td>{$vo.add_time|date="Y-m-d H:i:s",###}</td>
										<eq name="vo.type" value="buy">
										<td class="red">买入</td><else/> <td class="green">卖出</td></eq>
										<eq name="vo.type" value="buy">
										<td class="red">{$vo.price}</td><else/> <td class="green">{$vo.price}</td></eq>
										
										<td>{$vo.num}</td>
										<td>{$vo.money}</td>
									  </tr>
									</volist>
								</tbody>
								</table>
							</div>
						</div>
					</div>
					<!-- END CONDENSED TABLE PORTLET-->
				</div>
            </div>
                </div>
                <div class="col-md-4">
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box red">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-gift"></i> 委托信息
							</div>
							<div class="tools">
								<a href="javascript:;" class="collapse">
								</a>
								<a href="#portlet-config" data-toggle="modal" class="config">
								</a>
								<a href="javascript:;" class="reload">
								</a>
								<a href="javascript:;" class="remove">
								</a>
							</div>
						</div>
						<div class="portlet-body">
							<div class="table-scrollable">
								<table class="table table-bordered table-hover">
								<thead>
								<tr>
									<th>卖/买</th>
									<th>价格/数量</th>
									<th>委托量</th>
								</tr>
								</thead>
								<tbody>
								<tr>
							<volist name="sell_orders" id="vo" key="k">
                              <tr>
                                <td class="green">卖({$k})</td>
                                <td class="success">{$vo['num']-$vo['trade_num']}</td>
                                 <td></td>
                              </tr>
							  </volist>
							  <volist name="buy_orders" id="vo" key="k">
                              <tr>
                                <td class="red">买({$k})</td>
                                <td class="success">{$vo['allmoney']-$vo['money']}</td>
                                <td></td>
                              </tr>
							   </volist>
								</tr>
								</tbody>
								</table>
							</div>
						</div>
					</div>
					<!-- END SAMPLE TABLE PORTLET-->
				</div>
			</div>
<include file="App/Home/View/Public/footer.html"/>
	